﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using KandaAlpha.UI.Mvc;
using KandaAlpha.UI.Mvc.Controllers;
using KandaAlpha.Domain.Model.Entities;
using KandaAlpha.UI.Mvc.Models;

namespace KandaAlpha.UI.Mvc.Tests.Controllers
{
    [TestClass]
    public class HomeControllerTest
    {
        [TestMethod]
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController(new ApplicationService());

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            ViewDataDictionary viewData = result.ViewData;
            Assert.IsInstanceOfType(viewData.Model, typeof(HomeViewData));

            var homeViewData = viewData.Model as HomeViewData;

            Assert.AreEqual(2, homeViewData.Customers.Count()); 
        }

    }
}
